package com.jm.programming.lambda;

import java.util.function.Function;
import java.util.function.IntConsumer;

/**
 * @Description
 * @date 2022/6/29 7:46
 */
public class Test5 {
    public static void main(String[] args) {
        foreachArr(new IntConsumer() {
            @Override
            public void accept(int value) {
                System.out.println(value);
            }
        });

        foreachArr(value -> {
            System.out.println(value);
        });
    }

    public static void foreachArr(IntConsumer consumer){
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        for (int i : arr) {
            consumer.accept(i);
        }
    }
}
